package com.pet.item.controller;


import com.pet.common.domain.PageDTO;
import com.pet.common.domain.Result;
import com.pet.item.domain.po.Video;
import com.pet.item.domain.query.VideoQuery;
import com.pet.item.domain.vo.VideoDetailVO;
import com.pet.item.service.IVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 视频表 前端控制器
 * </p>
 *
 * @author Cookies
 * @since 2024-07-11
 */
@Api(tags = "视频服务接口")
@RestController
@RequestMapping("/videos")
@RequiredArgsConstructor
public class VideoController {
    private final IVideoService videoService;

    @PostMapping
    @ApiOperation("添加视频关联商品")
    public Result addVideo2Item(@RequestBody Video video) {
        return videoService.addVideo2Item(video);
    }

    @PostMapping("/list")
    @ApiOperation("分页获取视频列表")
    public Result getVideoList(@RequestBody VideoQuery videoQuery) {
        PageDTO<VideoDetailVO> pageDTO = videoService.getVideoList(videoQuery);
        return Result.success(pageDTO);
    }

}
